var textChildren = [];

textChildren.push(
    {
        _sType: "sText",
        innerText: "这是一个文本输入域1这是一个文本输入域2这是一个文本输入域3这是一个文本输入域4这是一个文本输入域5",
        style: {
            backgroundColor: "#9ee7c3"
        }
    },
    {
        _sType: "sLayer",
        children: [
            {
                _sType: "sImage",
                src: smallBase64,
                style: {
                    width: 100,
                    height: 100
                }
            }
        ],
        style: {
            width: 200,
            height: 100,
            //textDecoration: "underline"
            backgroundColor: "#9ee7c3",
            textDecoration: "underline"
        }
    },
    {
        _sType: "sText",
        innerText: "这是一张图片",
        style: {
            backgroundColor: "#9ee7c3",
            textDecoration: "underline"
        }
    },
    {
        _sType: "sText",
        innerText: "【新的段落】，这是一个文本输入域1这是一个文本输入域2这是一个文本输入域3这是一个文本输入域4这是一个文本输入域5",
        style: {
            backgroundColor: "#9ee7c3",
        }
    },
    {_sType:"sBreakline","style":{}},
    {
        _sType: "sText",
        innerText: "【新的段落2】，这是一个文本输入域1这是一个文本输入域2这是一个文本输入域3这是一个文本输入域4这是一个文本输入域5",
        style: {
            backgroundColor: "#9ee7c3",
        }
    },
    {_sType:"sBreakline","style":{}},
    {
        _sType: "sText",
        innerText: "【新的段落3】，这是一个文本输入域1这是一个文本输入域2这是一个文本输入域3这是一个文本输入域4这是一个文本输入域5",
        style: {
            backgroundColor: "#9ee7c3",
        }
    },
    {_sType:"sBreakline","style":{}},
    {
        _sType: "sText",
        innerText: "【新的段落4】，这是一个文本输入域1这是一个文本输入域2这是一个文本输入域3这是一个文本输入域4这是一个文本输入域5",
        style: {
            backgroundColor: "#9ee7c3",
        }
    },
    {
        _sType: "sParagraph",
        style: {
            lineHeight: 2,
            textIndent: 0,
            textAlign: "left"
        }
    },
    {
        _sType: "sText",
        innerText: "what is your name?",
        style: {
            color: "#000",
            fontSize: 16,
            fontFamily: "宋体",
            display: "block"
        }
    },
    {
        _sType: "sText",
        innerText: "你的名字是什么？",
        style: {
            color: "#000",
            fontSize: 16,
            fontFamily: "宋体",
            display: "block"
        }
    },
    {
        _sType: "sParagraph",
        style: {
            lineHeight: 1,
            textIndent: 0,
            textAlign: "justify"
        }
    },
);

var imgIndex = textChildren.length;

for (k = 0; k < 80; k++) {
    text = "/" + (k + 1) + "/美"
    var item = {
        _sType: "sText",
        innerText: text,
        style: {
            color: "#000",
            fontSize: 9 + k % 15,
            fontFamily: "宋体",
            lineHeight: 30,
            //display: k%2 == 0 ? "none" : "",
            textDecoration: "underline", //"line-through"
        }
    };

    textChildren.push(item);
}

textChildren.push({
    _sType: "sParagraph",
    style: {
        lineHeight: 3,
        textAlign: "justify",
        textIndent: 100,
    }
});

var imgs = {};

imgs[imgIndex] = { width: 80, height: 55 };
imgs[imgIndex + 2] = { width: 100, height: 100 };
imgs[imgIndex + 4] = { width: 100, height: 30 };
imgs[imgIndex + 12] = { width: 1200, height: 100 };

for (var l in imgs) {
    var img = imgs[l];
    textChildren.splice(l, 0,
        {
            _sType: "sLayer",
            children: [
                {
                    _sType: "sImage",
                    src: smallBase64,
                    style: {
                        width: 100,
                        height: 100
                    }
                }
            ],
            style: {
                width: img.width,
                height: img.height,
                textDecoration: "underline"
            }
        });
}

textChildren.push({
    _sType: "sText",
    innerText: "选择",
    style: {
        color: "#000",
        fontSize: 11,
        fontFamily: "宋体",
        lineHeight: 30,
        backgroundColor: "#eee"
    }
});

var index = 1;
for (j = 0; j < 1; j++) {
    var text = "";

    for (var i = 0; i < 5; i++) {
        text = "";
        for (var k = 0; k < 20; k++) {
            text += "基础数据【" + (index++) + "】门诊病历涉及到主诉、现病史、既往史、体格检查等等一系列的内容";
        }

        var item = {
            _sType: "sText",
            innerText: text,
            style: {
                color: "#000",
                fontSize: 11,
                fontFamily: "宋体",
                lineHeight: 30,
                backgroundColor: "#eee"
            }
        };

        textChildren.push(item);
    }
}

var endChildren = [
    {
        _sType: "sParagraph",
        style: {
            lineHeight: 2,
            textIndent: 100,
            textAlign: "justify-except-last"
        }
    },
    {
        _sType: "sText",
        innerText: "上海美莱美容http",
        style: {
            color: "#000",
            fontSize: "32",
            fontFamily: "宋体",
        }
    },
    {
        _sType: "sText",
        innerText: "http://crmuat.shmylike.cn/his/saas/indexZxAction.action;jsessionid=F1AE02FEFDF7D64FE1F53F4A387F89CB",
        //innerText: "buy",
        style: {
            color: "#000",
            fontSize: "20",
            fontFamily: "Arial",
        }
    },
    {
        _sType: "sParagraph",
        style: {
            lineHeight: 2,
            textIndent: 0,
            textAlign: "center"
        }
    },
];

textChildren = textChildren.concat(endChildren);

var tableInHeadFoot = {
    _sType: "sTable",
    style: {
        display: "block"
    },
    columns: [
        {
            _sType: "sTableColumn",
            style: {
                width: 300
            }
        },
        {
            _sType: "sTableColumn",
            style: {
                width: 100
            }
        },
        {
            _sType: "sTableColumn",
            style: {
                width: 100
            }
        }
    ],
    rows: [
        ////////////////////////////////// 第一行 ////////////////////////////////////
        {
            _sType: "sTableRow",
            cells: [
                {
                    _sType: "sTableCell",
                    rowspan: 2,
                    colspan: 1,
                    children: [
                        {
                            _sType: "sText",
                            innerText: "单元格11",
                            style: {
                                color: "#000",
                                fontSize: "18",
                                fontFamily: "宋体",
                            }
                        },
                        {
                            _sType: "sParagraph"
                        }
                    ],
                    style: {
                        //padding: "10",
                    }
                },
                {
                    _sType: "sTableCell",
                    rowspan: 1,
                    colspan: 1,
                    children: [
                        {
                            _sType: "sText",
                            innerText: "页",
                            style: {
                                color: "#000",
                                fontSize: "32",
                                fontFamily: "楷体",
                            }
                        },
                        {
                            _sType: "sParagraph",
                            style: {
                                lineHeight: 1,
                                textAlign: "center"
                            }
                        },
                    ],
                    style: {
                    }
                },
                {
                    _sType: "sTableCell",
                    rowspan: 1,
                    colspan: 1,
                    children: [
                        {
                            _sType: "sText",
                            innerText: "页眉",
                            style: {
                                color: "#000",
                                fontSize: "32",
                                fontFamily: "楷体",
                            }
                        },
                        {
                            _sType: "sParagraph",
                            style: {
                                lineHeight: 1,
                                textAlign: "center"
                            }
                        },
                    ],
                    style: {
                    }
                },
            ],
            style: {
                height: 100
            }
        },
    ],
}

var textResource = [].concat([
    //////////////////////////////// [页眉] /////////////////////////////////////////////
    {
        _sType: "sPageHead",
        children: [
            {
                _sType: "sText",
                innerText: "上",
                style: {
                    color: "#000",
                    fontSize: "32",
                    fontFamily: "宋体",
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sText",
                innerText: "海",
                style: {
                    color: "#000",
                    fontSize: "16",
                    fontFamily: "宋体",
                    textDecoration: "underline",
                    backgroundColor: "#ddd",
                    sup: true,
                }
            },
            {
                _sType: "sText",
                innerText: "美莱医",
                style: {
                    color: "#000",
                    fontSize: "32",
                    fontFamily: "宋体",
                    textDecoration: "underline",
                    backgroundColor: "#ccc"
                }
            },
            {
                _sType: "sText",
                innerText: "院",
                style: {
                    color: "#000",
                    fontSize: "32",
                    fontFamily: "宋体",
                    textDecoration: "underline",
                    backgroundColor: "#eee",
                    sub: true,
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 1,
                    textIndent: 0,
                    textAlign: "center"
                }
            },
            {
                _sType: "sText",
                innerText: "上海美莱医院2",
                style: {
                    color: "#000",
                    fontSize: "18",
                    fontFamily: "宋体",
                    textDecoration: "line-through"
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 1,
                    textIndent: 100,
                    textAlign: "left"
                }
            },
            {
                _sType: "sText",
                innerText: "门诊病历1",
                style: {
                    color: "#000",
                    fontSize: "14",
                    fontFamily: "宋体",
                }
            },
            {
                _sType: "sText",
                innerText: "门诊病历2门诊病历3门诊病历4门诊病历5门诊病历6门诊病历7门诊病历8门诊病历9",
                style: {
                    color: "#000",
                    fontSize: "12",
                    fontFamily: "宋体",
                    textDecoration: "line-through"
                }
            },
            {
                _sType: "sText",
                innerText: "门诊病历10",
                style: {
                    color: "#000",
                    fontSize: "14",
                    fontFamily: "宋体",
                    textDecoration: "line-through"
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 1,
                    textIndent: 100,
                    textAlign: "justify"
                }
            },
            {
                _sType: "sText",
                innerText: "页眉图片",
                style: {
                    color: "#000",
                    fontSize: "10",
                    fontFamily: "宋体",
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sLayer",
                children: [
                    {
                        _sType: "sImage",
                        src: smallBase64,
                        style: {
                            width: 100,
                            height: 100
                        }
                    }
                ],
                style: {
                    width: 99,
                    height: 50,
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sText",
                innerText: "Chrome 有助于保护您免受数据泄露、不良扩展程序等问题的影响控制网站可以使用和显示什么信息（如位置信息、摄像头、弹出式窗口及其他）Chrome 的诞生离不开 Chromium 开源项目以及其他开源软件。",
                style: {
                    color: "#00F",
                    fontSize: "10",
                    fontFamily: "宋体",
                    textDecoration: "underline",
                    backgroundColor: "#81f4ff"
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 2,
                    textIndent: 100,
                    textAlign: "justify-except-last"
                }
            },
            //tableInHeadFoot
        ],
        style: {
        }
    },
    //////////////////////////////// [页脚] /////////////////////////////////////////////
    {
        _sType: "sPageFoot",
        children: [
            {
                _sType: "sText",
                innerText: "页码：",
                style: {
                    fontSize: 11
                }
            },
            {
                _sType: "sLayer",
                children: [
                    {
                        _sType: "sText",
                        innerText: "第1页",
                        variable: {
                            name: "pageIndex",
                            format: "第{pageIndex}页"
                        },
                        style: {
                        }
                    },
                    {
                        _sType: "sParagraph",
                        style: {
                            lineHeight: 2,
                            textIndent: 0,
                            textAlign: "center"
                        }
                    },
                ],
                style: {
                    width: 200,
                    height: 50,
                    backgroundColor: "#ddd"
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 1,
                    textIndent: 0,
                    textAlign: "center"
                }
            },
            //tableInHeadFoot,
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 4,
                    textIndent: 0,
                    textAlign: "left"
                }
            },
            {
                _sType: "sLayer",
                children: [
                    {
                        _sType: "sImage",
                        src: smallBase64,
                        style: {
                        }
                    }
                ],
                style: {
                    width: 99,
                    height: 30,
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sLayer",
                children: [
                    {
                        _sType: "sImage",
                        src: smallBase64,
                        style: {
                        }
                    }
                ],
                style: {
                    width: 99,
                    height: 20,
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sLayer",
                children: [
                    {
                        _sType: "sImage",
                        src: smallBase64,
                        style: {
                        }
                    }
                ],
                style: {
                    width: 99,
                    height: 50,
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sText",
                innerText: "这里是页脚，设置固定信息",
                style: {
                    color: "#000",
                    fontSize: "16",
                    fontFamily: "宋体",
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sText",
                innerText: "以及页码",
                style: {
                    color: "#000",
                    fontSize: "12",
                    fontFamily: "宋体",
                    textDecoration: "underline"
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 4,
                    textIndent: 0,
                    textAlign: "right"
                }
            },
            {
                _sType: "sText",
                innerText: "http://test.api.fabigbig.com:8888/api/extsign.api?app_id=406777&v=2.0&timestamp=20230512152742&transaction_id=test20230512&customer_id=C6BB275F77309B8084525EDC2F65CBA0&contract_id=test20230512&doc_title=%E6%B5%8B%E8%AF%95%E6%96%87%E6%A1%A3test20230512&keyword_strategy=0&mobile_sign_type=2&sign_verify_way=1&pc_hand_signature=1&signature_show_time=2&writing_track=0&return_url=",
                style: {
                    color: "#000",
                    fontSize: "9",
                    fontFamily: "宋体",
                    textDecoration: "line-through",
                    backgroundColor: "#fdff75",
                }
            },
            {
                _sType: "sParagraph",
                style: {
                    lineHeight: 2,
                    textIndent: 100,
                    textAlign: "justify",
                }
            }
        ],
        style: {
        }
    },
    //////////////////////////////// [页体] /////////////////////////////////////////////
    {
        _sType: "sPageBody",
        children: textChildren,
        style: {
        }
    },
]);

